package com.leyou.user.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * @Author: Rose
 * @Date: 2021/4/9 22:44
 * @description ${description}
 * @version: 1.0.0
 */
@Data
@Table(name = "tb_user")
public class User {

    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Length(min = 4, max = 32, message = "用户名长度必须在4~32位")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Length(min = 6, max = 16, message = "密码长度必须在4~32位")
    @JsonIgnore
    private String password;

    /**
     * 电话
     */
    //@Pattern(regexp = "")
    @NotBlank(message = "手机号不能为空")
    private String phone;


    /**
     * 创建时间
     */
    private Date created;

    /**
     * 密码的盐
     */
    @JsonIgnore
    private String salt;

}
